SET DEFINE OFF;

CREATE OR REPLACE PACKAGE CAPBRIMP_MAPPING
IS
	PROCEDURE UpdateNGOCode(
		pNGO		VARCHAR2
	);

	FUNCTION RenameStr(
		pNGO		VARCHAR2,
		pStr		VARCHAR2
	) RETURN VARCHAR2;

	FUNCTION ReverseStr(
		pNGO		VARCHAR2,
		pStr		VARCHAR2
	) RETURN VARCHAR2;

	FUNCTION GetBGMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetSOBIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetUserMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetOrgMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetLocationIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetBankACMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetPayProgramMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetPayFormatMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetCheckIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetCheckStockIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAPBatchIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAPInvoiceIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAPDistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAPSelInvCheckIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAPInvSelCrtIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetInvPaymentIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetPayHistoryIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAccEventIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAEHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetAELineIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetRACustTRXIDMapping(
		pOldID		NUMBER								--Need Update / 13-3-2006 Update by B.C
	) RETURN NUMBER;

	FUNCTION GetRACustTRXLnDistIDMapping(
		pOldID		NUMBER								--Need Update / 13-3-2006 Update by B.C
	) RETURN NUMBER;

	FUNCTION GetRACustomerIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

	FUNCTION GetARCashReceiptIDMapping(
		pOldID		NUMBER								--Need Update / 13-3-2006 Update by B.C
	) RETURN NUMBER;

	FUNCTION GetARCashReceiptHistIDMapping(
		pOldID		NUMBER								--Need Update / 13-3-2006 Update by B.C
	) RETURN NUMBER;

	FUNCTION GetARReceivableAppIDMapping(
		pOldID		NUMBER								--Need Update / 13-3-2006 Update by B.C
	) RETURN NUMBER;

	FUNCTION GetARLineIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

	FUNCTION GetARMiscCashDistIDMapping(
		pOldID		NUMBER								--Need Update / 13-3-2006 Update by B.C
	) RETURN NUMBER;

	FUNCTION GetPOHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetPOReqHeaderIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

	FUNCTION GetPOReqDistIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

	FUNCTION GetPOTXNIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

/****** FND *********************************/
	FUNCTION GetFNDValueSetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDValueIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDValueHierIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDMenuIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDReqGrpIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDRespIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDConcurrentPrgIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFNDDocSeqIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetRequestSetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetRequestSetStageIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
/****** FND *********************************/

	FUNCTION GetCustIDMapping(
		pOldID		NUMBER								--Need Update 
	) RETURN NUMBER;

	FUNCTION GetCustSiteIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

	FUNCTION GetPODistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetBCPacketIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER;

/****** FA **********************************/
	FUNCTION GetAssetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetTXNHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetRetirementIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFADistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFAWarrrantyIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetMassReclassIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetFAInvoiceTXNIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
/****** FA **********************************/

/****** GL **********************************/
	FUNCTION GetFNDValueRuleIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetGLAllocBatchIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetGLAllocFormulaIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetGLAutoPostSetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetJEBatchIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetJEHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;

	FUNCTION GetGLConversionTypeMapping(
		pOldType	VARCHAR2
	) RETURN VARCHAR2;
	
	FUNCTION GetEmployeeMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
	
	FUNCTION GetOrganizationMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
	
	FUNCTION GetCCIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
/****** GL **********************************/
		FUNCTION GetOUMapping(
		pOldOU	VARCHAR2
	) RETURN VARCHAR2;
	
		FUNCTION GetGLAutoPostSetIDMapping(
		pOldID	NUMBER,
		pJELINES VARCHAR2
	) RETURN NUMBER;
	
	FUNCTION GetAssetKeyMapping(
		pOldID NUMBER
	)RETURN NUMBER;
	
	FUNCTION GetMassAdditionMapping(
		pOldID NUMBER
	)RETURN NUMBER;
	
	FUNCTION GetFALocationMapping(
		pOldID NUMBER
	)RETURN NUMBER;
	
	FUNCTION GetFAValueIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
	
	FUNCTION GetSecurityProfileMapping(
		pOldID		NUMBER
	) RETURN NUMBER;
	
	
END CAPBRIMP_MAPPING;
/
SET DEFINE OFF;

CREATE OR REPLACE PACKAGE BODY CAPBRIMP_MAPPING
IS
/********************************************************/
	PROCEDURE UpdateNGOCode(
		pNGO		VARCHAR2
	)  IS
		lv_Ver		CHAR(1);
		lv_Num		NUMBER;
	BEGIN
		SELECT	Ver
		INTO	lv_Ver
		FROM	CRST_NGO_MAP
		WHERE	NGO		=	pNGO;

		lv_Num	:=	ASCII(lv_Ver);
		IF		lv_Num	=	57	THEN
			lv_Num	:=	65;
		ELSIF	lv_Num	=	90	THEN
			lv_Num	:=	97;
		ELSIF	lv_Num	=	122	THEN
			lv_Num	:=	48;
		ELSE
			lv_Num	:=	lv_Num	+	1;
		END IF;
		lv_Ver	:=	CHR(lv_Num);

		UPDATE
			CRST_NGO_MAP
		SET
			Ver					=	lv_Ver,
			NGO_N				=	SUBSTR(NGO,1,1)||lv_Ver||SUBSTR(NGO,3,2),
			Last_Update_Date	=	SYSDATE
		WHERE
			NGO = pNGO;

		COMMIT;
	END UpdateNGOCode;
/********************************************************/
	FUNCTION RenameStr(
		pNGO		VARCHAR2,
		pStr		VARCHAR2
	) RETURN VARCHAR2 IS
		lv_NGO_N		VARCHAR2(4);
	BEGIN
		 BEGIN
		 SELECT	NGO_N
		 INTO	lv_NGO_N
		 FROM	CRST_NGO_MAP
		 WHERE	NGO	=	pNGO;
		 EXCEPTION
		 	WHEN NO_DATA_FOUND THEN
		 		lv_NGO_N := pNGO;
		 END;
		 RETURN(REPLACE(pStr,pNGO,lv_NGO_N));
	END RenameStr;
/********************************************************/
	FUNCTION ReverseStr(
		pNGO		VARCHAR2,
		pStr		VARCHAR2
	) RETURN VARCHAR2 IS
		lv_NGO		VARCHAR2(4);
	BEGIN
		 SELECT	NGO
		 INTO	lv_NGO
		 FROM	CRST_NGO_MAP
		 WHERE	NGO_N	=	pNGO;
		 RETURN(REPLACE(pStr,pNGO,lv_NGO));
	END ReverseStr;
/********************************************************/
	FUNCTION GetBGMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	BG_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_BG_MAP
			WHERE	BG_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetBGMapping;
/********************************************************/
	FUNCTION GetSOBIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	SET_OF_BOOKS_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_SETS_OF_BOOKS_MAP
			WHERE	SET_OF_BOOKS_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetSOBIDMapping;
/********************************************************/
	FUNCTION GetUserMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	USER_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_USER_MAP
			WHERE	USER_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
		END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetUserMapping;
/********************************************************/
	FUNCTION GetOrgMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
		BEGIN
			SELECT	ORGANIZATION_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_ORG_UNITS_MAP
			WHERE	ORGANIZATION_ID	=	pOldID;
		EXCEPTION
			WHEN NO_DATA_FOUND THEN
				lv_NewID := pOldID;
		END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetOrgMapping;
/********************************************************/
	FUNCTION GetLocationIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	LOCATION_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_LOCATION_MAP
			WHERE	LOCATION_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetLocationIDMapping;
/********************************************************/
	FUNCTION GetBankACMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	Bank_Account_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_BANK_ACCOUNTS_MAP
			WHERE	Bank_Account_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetBankACMapping;
/********************************************************/
	FUNCTION GetPayProgramMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	Program_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_PAY_PROGRAMS_MAP
			WHERE	Program_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetPayProgramMapping;
/********************************************************/
	FUNCTION GetPayFormatMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CHECK_FORMAT_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_PAY_FORMAT_MAP
			WHERE	CHECK_FORMAT_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetPayFormatMapping;
/********************************************************/
	FUNCTION GetCheckIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CHECK_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_CHECKS_MAP
			WHERE	CHECK_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetCheckIDMapping;
/********************************************************/
	FUNCTION GetCheckStockIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CHECK_STOCK_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_CHECK_STOCKS_MAP
			WHERE	CHECK_STOCK_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetCheckStockIDMapping;
/********************************************************/
	FUNCTION GetAPBatchIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	BATCH_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_BATCHES_MAP
			WHERE	BATCH_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAPBatchIDMapping;
/********************************************************/
	FUNCTION GetAPInvoiceIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	INVOICE_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_INVOICES_MAP
			WHERE	INVOICE_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAPInvoiceIDMapping;
/********************************************************/
	FUNCTION GetAPDistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	Invoice_Distribution_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_INVOICES_DIST_MAP
			WHERE	Invoice_Distribution_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAPDistIDMapping;
/********************************************************/
	FUNCTION GetAPSelInvCheckIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	SELECTED_CHECK_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_SELECT_INV_CHECKS_MAP
			WHERE	SELECTED_CHECK_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAPSelInvCheckIDMapping;
/********************************************************/
	FUNCTION GetAPInvSelCrtIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CHECKRUN_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_INV_SELECT_CRT_MAP
			WHERE	CHECKRUN_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAPInvSelCrtIDMapping;
/********************************************************/
	FUNCTION GetInvPaymentIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	INVOICE_PAYMENT_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_INV_PAYMENT_MAP
			WHERE	INVOICE_PAYMENT_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetInvPaymentIDMapping;
/********************************************************/
	FUNCTION GetPayHistoryIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	PAYMENT_HISTORY_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_PAY_HISTORY_MAP
			WHERE	PAYMENT_HISTORY_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetPayHistoryIDMapping;
/********************************************************/
	FUNCTION GetAccEventIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	ACCOUNTING_EVENT_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_ACCOUNTING_EVENTS_MAP
			WHERE	ACCOUNTING_EVENT_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAccEventIDMapping;
/********************************************************/
	FUNCTION GetAEHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	AE_HEADER_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_AE_HEADERS_MAP
			WHERE	AE_HEADER_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAEHeaderIDMapping;
/********************************************************/
	FUNCTION GetAELineIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	AE_LINE_ID_N
			INTO	lv_NewID
			FROM	CRST_AP_AE_LINES_MAP
			WHERE	AE_LINE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAELineIDMapping;
/********************************************************/
	FUNCTION GetRACustTRXIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
			IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CUSTOMER_TRX_ID_N
			INTO	lv_NewID
			FROM	CRST_RA_CUSTOMER_TRX_ALL
			WHERE	CUSTOMER_TRX_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetRACustTRXIDMapping;
/********************************************************/
	FUNCTION GetRACustTRXLnDistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
		BEGIN
			IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CUSTOMER_TRX_LINE_ID_N
			INTO	lv_NewID
			FROM	CRST_RA_CUSTOMER_TRX_LINES_ALL
			WHERE	CUSTOMER_TRX_LINE_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetRACustTRXLnDistIDMapping;
/********************************************************/
	FUNCTION GetRACustomerIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			lv_NewID	:=	pOldID;		--	to be updated when RA_CUSTOMERS mapping available
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetRACustomerIDMapping;
/********************************************************/
	FUNCTION GetARCashReceiptIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CASH_RECEIPT_ID_N
			INTO	lv_NewID
			FROM	CRST_AR_CASH_RECEIPTS_ALL
			WHERE	CASH_RECEIPT_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetARCashReceiptIDMapping;
/********************************************************/
	FUNCTION GetARCashReceiptHistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CASH_RECEIPT_HISTORY_ID_N
			INTO	lv_NewID
			FROM	CRST_AR_CASH_RECEIPT_HISTORY
			WHERE	CASH_RECEIPT_HISTORY_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetARCashReceiptHistIDMapping;
/********************************************************/
	FUNCTION GetARReceivableAppIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	RECEIVABLE_APPLICATION_ID_N
			INTO	lv_NewID
			FROM	CRST_AR_RECEIVABLE_APPLICATION
			WHERE	RECEIVABLE_APPLICATION_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
	END GetARReceivableAppIDMapping;
/********************************************************/
	FUNCTION GetARLineIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT LINE_ID_N
			INTO lv_NewID
			FROM CRST_AR_DISTRIBUTIONS_ALL
			WHERE LINE_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
			--lv_NewID	:=	pOldID;		--	to be updated when AR_DISTRIBUTIONS_ALL mapping available
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetARLineIDMapping;
/********************************************************/
	FUNCTION GetARMiscCashDistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	MISC_CASH_DISTRIBUTION_ID_N
			INTO	lv_NewID
			FROM	CRST_AR_MISC_CASH_DISTRIBUTION
			WHERE	MISC_CASH_DISTRIBUTION_ID = pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
	END GetARMiscCashDistIDMapping;
/********************************************************/
	FUNCTION GetPOHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
	BEGIN
		RETURN(CAPPOIMP_MAPPING.GetPOHeaderIDMapping(pOldID));
	END GetPOHeaderIDMapping;
/********************************************************/
	FUNCTION GetPOReqHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
	BEGIN
		RETURN(CAPPOIMP_MAPPING.GetPRHeaderIDMapping(pOldID));
	END GetPOReqHeaderIDMapping;
/********************************************************/
	FUNCTION GetPOReqDistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
	BEGIN
		RETURN(CAPPOIMP_MAPPING.GetPRDistributionIDMapping(pOldID));
	END GetPOReqDistIDMapping;
/********************************************************/
	FUNCTION GetPOTXNIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
	BEGIN
		RETURN(CAPPOIMP_MAPPING.GetReceiptTransactionIDMapping(pOldID));
	END GetPOTXNIDMapping;
/********************************************************/
	FUNCTION GetFNDValueSetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	FLEX_VALUE_SET_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_VALUE_SETS_MAP
			WHERE	FLEX_VALUE_SET_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDValueSetIDMapping;
/********************************************************/
	FUNCTION GetFNDValueIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	FLEX_VALUE_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_VALUES_MAP
			WHERE	FLEX_VALUE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDValueIDMapping;
/********************************************************/
	FUNCTION GetFNDValueHierIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	HIERARCHY_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_HIER_MAP
			WHERE	HIERARCHY_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDValueHierIDMapping;
/********************************************************/
	FUNCTION GetFNDMenuIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	MENU_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_MENUS_MAP
			WHERE	MENU_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDMenuIDMapping;
/********************************************************/
	FUNCTION GetFNDReqGrpIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	REQUEST_GROUP_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_RESP_REQ_GRP_MAP
			WHERE	REQUEST_GROUP_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDReqGrpIDMapping;
/********************************************************/
	FUNCTION GetFNDRespIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	RESPONSIBILITY_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_RESPONSIBILITY_MAP
			WHERE	RESPONSIBILITY_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDRespIDMapping;
/********************************************************/
	FUNCTION GetFNDConcurrentPrgIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CONCURRENT_PROGRAM_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_CONC_PROG_MAP
			WHERE	CONCURRENT_PROGRAM_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
			
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDConcurrentPrgIDMapping;
/********************************************************/
	FUNCTION GetFNDDocSeqIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	DOC_SEQUENCE_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_DOCUMENT_SEQ_MAP
			WHERE	DOC_SEQUENCE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDDocSeqIDMapping;
/********************************************************/
	FUNCTION GetRequestSetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	REQUEST_SET_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_REQUEST_SETS_MAP
			WHERE	REQUEST_SET_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetRequestSetIDMapping;
/********************************************************/
	FUNCTION GetRequestSetStageIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	REQUEST_SET_STAGE_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_REQ_SET_STAGE_MAP
			WHERE	REQUEST_SET_STAGE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetRequestSetStageIDMapping;
/********************************************************/
	FUNCTION GetCustIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
				SELECT CUSTOMER_ID_N
				INTO lv_NewID
				FROM CRST_RA_CUSTOMERS
				WHERE CUSTOMER_ID = pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
				END;
			--lv_NewID	:=	pOldID;		--	to be add code when Cust ID mapping available
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetCustIDMapping;
/********************************************************/
	FUNCTION GetCustSiteIDMapping(
		pOldID		NUMBER								--Need Update
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			lv_NewID	:=	pOldID;		--	to be add code when Cust ID mapping available
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetCustSiteIDMapping;
/********************************************************/
	FUNCTION GetPODistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
	BEGIN
		RETURN(CAPPOIMP_MAPPING.GetPODistributionIDMapping(pOldID));
	END GetPODistIDMapping;
/********************************************************/
	FUNCTION GetBCPacketIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			lv_NewID	:=	pOldID;		--	to be add code when JE BC Packet ID mapping available
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetBCPacketIDMapping;
/********************************************************/
	FUNCTION GetGLAllocFormulaIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	ALLOCATION_FORMULA_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_ALLOC_FORMULAS_MAP
			WHERE	ALLOCATION_FORMULA_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetGLAllocFormulaIDMapping;
/********************************************************/
	FUNCTION GetGLAutoPostSetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	AUTOPOST_SET_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_AUTO_POSTING_SETS_MAP
			WHERE	AUTOPOST_SET_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetGLAutoPostSetIDMapping;
/********************************************************/
	FUNCTION GetJEBatchIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	JE_BATCH_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_JE_BATCHES_MAP
			WHERE	JE_BATCH_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetJEBatchIDMapping;
/********************************************************/
	FUNCTION GetJEHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	JE_HEADER_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_JE_HEADERS_MAP
			WHERE	JE_HEADER_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetJEHeaderIDMapping;
/********************************************************/
	FUNCTION GetGLConversionTypeMapping(
		pOldType	VARCHAR2
	) RETURN VARCHAR2 IS
		lv_NewType	VARCHAR2(30);
	BEGIN
		IF	pOldType	IS	NOT NULL	THEN
			SELECT	CONVERSION_TYPE_N
			INTO	lv_NewType
			FROM	CRST_GL_DAILY_CONV_TYPES_MAP
			WHERE	CONVERSION_TYPE	=	pOldType;
		ELSE
			lv_NewType	:=	NULL;
		END IF;
		RETURN(lv_NewType);
	END GetGLConversionTypeMapping;
/********************************************************/
	FUNCTION GetAssetIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	ASSET_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_ADDITIONS_B_MAP
			WHERE	ASSET_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAssetIDMapping;
/********************************************************/
	FUNCTION GetTXNHeaderIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	TRANSACTION_HEADER_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_TXN_HEADERS_MAP
			WHERE	TRANSACTION_HEADER_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetTXNHeaderIDMapping;
/********************************************************/
	FUNCTION GetRetirementIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	RETIREMENT_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_RETIREMENTS_MAP
			WHERE	RETIREMENT_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetRetirementIDMapping;
/********************************************************/
	FUNCTION GetFADistIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	DISTRIBUTION_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_DIST_HIST_MAP
			WHERE	DISTRIBUTION_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
			END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFADistIDMapping;
/********************************************************/
	FUNCTION GetFAWarrrantyIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	WARRANTY_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_WARRANTIES_MAP
			WHERE	WARRANTY_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFAWarrrantyIDMapping;
/********************************************************/
	FUNCTION GetMassReclassIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	MASS_RECLASS_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_MASS_RECLASS_MAP
			WHERE	MASS_RECLASS_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetMassReclassIDMapping;
/********************************************************/
	FUNCTION GetFAInvoiceTXNIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	INVOICE_TRANSACTION_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_INV_TXN_MAP
			WHERE	INVOICE_TRANSACTION_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFAInvoiceTXNIDMapping;
/********************************************************/
	FUNCTION GetFNDValueRuleIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	FLEX_VALUE_RULE_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_FLEX_VALUE_RULES_MAP
			WHERE	FLEX_VALUE_RULE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFNDValueRuleIDMapping;
/********************************************************/
	FUNCTION GetGLAllocBatchIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	ALLOCATION_BATCH_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_ALLOC_BATCHES_MAP
			WHERE	ALLOCATION_BATCH_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetGLAllocBatchIDMapping;
/********************************************************/
    FUNCTION GetEmployeeMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	PERSON_ID_N
			INTO	lv_NewID
			FROM	crst_fnd_per_all_people_map
			WHERE	PERSON_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
				END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetEmployeeMapping;
/********************************************************/
    FUNCTION GetOrganizationMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	ORGANIZATION_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_ORG_UNITS_MAP
			WHERE	ORGANIZATION_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetOrganizationMapping;
/********************************************************/
    FUNCTION GetCCIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	CODE_COMBINATION_ID_N
			INTO	lv_NewID
			FROM	CRST_GL_CODE_COMB_MAP
			WHERE	CODE_COMBINATION_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetCCIDMapping;
/********************************************************/
    FUNCTION GetOUMapping(
		pOldOU		VARCHAR2
	) RETURN VARCHAR2 IS
		lv_NewOU		VARCHAR2(100);
	BEGIN
		 IF pOldOU	IS	NOT NULL	THEN
			SELECT	NAME
			INTO	lv_NewOU
			FROM	CRST_FND_ORG_UNITS_MAP
			WHERE	NAME_N	=	pOldOU;
		ELSE
			lv_NewOU	:=	NULL;
		END IF;
		RETURN(lv_NewOU);
	END GetOUMapping;
/********************************************************/
	FUNCTION GetGLAutoPostSetIDMapping(
		pOldID	NUMBER,
		pJELINES VARCHAR2
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF pOldID IS NOT NULL THEN
			SELECT  AUTOPOST_SET_ID_N
			INTO lv_NewID
			FROM CRST_GL_AUTOPOSTING_MAP
			WHERE AUTOPOST_SET_ID = pOldID
			AND	  JE_SOURCE_NAME = pJELINES;
		ELSE
			lv_NewID := NULL;
		END IF;
		RETURN(lv_NewID);
	END GetGLAutoPostSetIDMapping;
/********************************************************/
	FUNCTION GetAssetKeyMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	CODE_COMBINATION_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_ASSET_KEYWORDS
			WHERE	CODE_COMBINATION_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
				END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetAssetKeyMapping;
/********************************************************/
	FUNCTION GetMassAdditionMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	MASS_ADDITION_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_MASS_ADDITIONS_MAP
			WHERE	MASS_ADDITION_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
				END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetMassAdditionMapping;
/********************************************************/
	FUNCTION GetFAlocationMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			BEGIN
			SELECT	LOCATION_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_LOCATIONS
			WHERE	LOCATION_ID	=	pOldID;
			EXCEPTION
				WHEN NO_DATA_FOUND THEN
					lv_NewID := pOldID;
				END;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFAlocationMapping;
/********************************************************/
	FUNCTION GetFAValueIDMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	FLEX_VALUE_ID_N
			INTO	lv_NewID
			FROM	CRST_FA_VALUES_MAP
			WHERE	FLEX_VALUE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetFAValueIDMapping;
/********************************************************/
	FUNCTION GetSecurityProfileMapping(
		pOldID		NUMBER
	) RETURN NUMBER IS
		lv_NewID		NUMBER;
	BEGIN
		IF	pOldID	IS	NOT NULL	THEN
			SELECT	SECURITY_PROFILE_ID_N
			INTO	lv_NewID
			FROM	CRST_FND_SECURITY_PROFILE
			WHERE	SECURITY_PROFILE_ID	=	pOldID;
		ELSE
			lv_NewID	:=	NULL;
		END IF;
		RETURN(lv_NewID);
	END GetSecurityProfileMapping;
/********************************************************/
END CAPBRIMP_MAPPING;
/
